<?php
/**
 * Created by PhpStorm.
 * User: xiaoxin
 * Date: 2018/10/25 0025
 * Time: 17:41
 */

include './functions.php';
include './Db.php';
$card_id = $_POST;
session_start();
if (!isset($_SESSION['user_id'])){
	exit(json_encode(['code'=>1,'msg'=>'请先登陆']));
}
$db = new Db('card');
$res = $db->find($card_id['card_id']);
if ($res['username']!=$_SESSION['username']){
	exit(json_encode(['code'=>1,'msg'=>'你没有权限操作']));
}
$res = $db->del($card_id['card_id']);
if ($res){
	exit(json_encode(['code'=>0,'msg'=>'已删除']));
}else{
	exit(json_encode(['code'=>1,'msg'=>'删除失败']));
}
